//
//  FirstViewController.m
//  Traveling
//
//  Created by lanou3g on 16/3/22.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "FirstViewController.h"
#import "ButtonView.h"
#define bartintColor [UIColor colorWithRed:0/255.0 green:250/255.0 blue:154/255.0 alpha:1]
@interface FirstViewController () <UITableViewDataSource , UITableViewDelegate>

@property (nonatomic , strong)UITableView *tableView ;
@property (nonatomic , strong)ButtonView *buttonView ;


@end

@implementation FirstViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"首页";
    self.navigationController.navigationBar.barTintColor = bartintColor;
    
    self.tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds style:(UITableViewStylePlain)] ;
    [self.view addSubview:self.tableView] ;
    
//   设置代理
    self.tableView.delegate = self ;
    self.tableView.dataSource = self ;
    
}



#pragma mark  - - -  - -- -  - - - -tableView  - -- - - - - - - -- 
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 50;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 110 ;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"] ;
    }
    
    // Configure the cell...
    cell.textLabel.text = @"haha" ;
    
    return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    self.buttonView = [[ButtonView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 110)] ;
    //    给每个按钮添加点击事件
    [self.buttonView.aButton addTarget:self action:@selector(aButton) forControlEvents:UIControlEventTouchUpInside] ;
    [self.buttonView.bButton addTarget:self action:@selector(bButton) forControlEvents:UIControlEventTouchUpInside] ;
    [self.buttonView.cButton addTarget:self action:@selector(cButton) forControlEvents:UIControlEventTouchUpInside] ;
    [self.buttonView.dButton addTarget:self action:@selector(dButton) forControlEvents:UIControlEventTouchUpInside] ;
    [self.buttonView.eButton addTarget:self action:@selector(eButton) forControlEvents:UIControlEventTouchUpInside] ;
    [self.buttonView.fButton addTarget:self action:@selector(fButton) forControlEvents:UIControlEventTouchUpInside] ;
    
    return self.buttonView ;
}

//实现六个按钮的方法
- (void)aButton{
}

- (void)bButton{
}

- (void)cButton{
}

- (void)dButton{
}

- (void)eButton{
}

- (void)fButton{
}









- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
